﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Castle.ActiveRecord;

namespace SinsenWeb.Models
{
    [ActiveRecord]
    public class Article: EntityBase<Article>, IEntity
    {
        [PrimaryKey]
        public int Id { get; set; }

        [Property]
        public string Title { get; set; }

        [Property]
        public bool Active { get; set; }
        
        [Property]
        public DateTime PublishedDate { get; set; }

        [Property]
        public string MainIntro { get; set; }

        [Property]
        public string MainBody { get; set; }

        [Property]
        public string ImageUrl { get; set; }

        /// <summary>
        /// 0 = External News
        /// 1 = Internal News
        /// 2 = FrontPage Item
        /// 3 = BoardMinutes
        /// </summary>
        [Property]
        public int ArticleType { get; set; }

        public string ArticleTypeText
        {
            get
            {
                switch(ArticleType)
                {
                    case 1:
                        return "Intern nyhet(kun synlig for medlemmer)";
                    case 2:
                        return "Forsidesak";
                    case 3:
                        return "Styrereferat";
                    case 0:
                        default:
                        return "Ekstern nyhet(synlig for alle)";
                        
                }
            }
        }

        [Property]
        public string Slug { get; set; }

    }
}
